import requests,re

class TinyShop_1:
    #获取注册请求Token
    def __init__(self):
        self.host = "http://192.168.4.108"
        self.s = requests.session()
        r = self.s.get(self.host+"/TinyShop/index.php?con=simple&act=reg")
        self.tiny_token_reg = re.findall("tiny_token_reg\' value=\'(.*)\'/>",r.text)[0]
        print(self.tiny_token_reg)

  #发送注册请求
    def regirter(self,email,pwd,repwd):
        param = {"email":email,
                 "password":pwd,
                 "repassword":repwd,
                 #"verifyCode":"aaaa",
                 "user_status":"",
                 "tiny_token_reg":"%s"%self.tiny_token_reg}
        url = self.host+"/TinyShop/index.php?con=simple&act=reg_act"
        reg =  self.s.post(url=url,data=param)
        print(reg.text)
        return reg.text


        # if "value=\"http://mail.qq.com\"" in reg.text:
        #     print("注册完成")
        # else:
        #     print("注册失败")


if __name__ == "__main__":
    t = TinyShop_1()
    t.regirter("11241@qq.com","123456","123456")
